package org.myspringframework.proxy.service;

/**
 * 静态代理
 */
public class OrderServiceProxy implements OrderService {
    private OrderService target;

    public OrderServiceProxy(OrderService target) {
        this.target = target;
    }

    @Override
    public void generate() {
        long start = System.currentTimeMillis();
        target.generate();
        long end = System.currentTimeMillis();
        System.out.println("generate耗时时间" + (start - end) + "ms");
    }

    @Override
    public void modify() {
        long start = System.currentTimeMillis();
        target.modify();
        long end = System.currentTimeMillis();
        System.out.println("modify耗时时间" + (start - end) + "ms");
    }

    @Override
    public void detail() {
        long start = System.currentTimeMillis();
        target.detail();
        long end = System.currentTimeMillis();
        System.out.println("detail耗时时间" + (start - end) + "ms");
    }
}
